package com.yy.controller;


import com.github.pagehelper.PageInfo;
import com.yy.domain.AppointmentTasksDO;
import com.yy.domain.PatientExaminationDO;
import com.yy.domain.ResponseResult;
import com.yy.dto.DoctorDTO;
import com.yy.service.GptPatientEvaluationService;
import com.yy.service.PatientExaminationService;
import com.yy.vo.AppointmentTasksPageVO;
import com.yy.vo.PatientEvaluationVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 患儿检查信息表 前端控制器
 * </p>
 *
 * @author 姚欣宏
 * @since 2024-04-12
 */
@RestController
@RequestMapping("/patientExamination")
public class PatientExaminationController {


    @Autowired
    PatientExaminationService patientExaminationService;

    @ApiOperation("提交预约")
    @PostMapping("/add")
    public ResponseResult<Integer> insertEvaluate(@RequestBody PatientExaminationDO patientEvaluationVO) {
        Integer code = patientExaminationService.insertEvaluate(patientEvaluationVO);
        return new ResponseResult<>(code, "保存成功");
    }

    @GetMapping("/getLatestByRegistrationAndPhone")
    public ResponseResult<PatientExaminationDO> getLatestByRegistrationAndPhone(@RequestParam String patientRegistrationNumber, @RequestParam String contactPhone) {
        PatientExaminationDO patientExaminationDO = patientExaminationService.getLatestByRegistrationAndPhone(patientRegistrationNumber, contactPhone);
        return new ResponseResult<>(200, "请求成功", patientExaminationDO);
    }

    @GetMapping("/getExaminationDate")
    public ResponseResult<List<PatientExaminationDO>> getExaminationDate(@RequestParam String examinationDate) {
        List<PatientExaminationDO> patientExaminationDOS = patientExaminationService.getExaminationDate(examinationDate);
        return new ResponseResult<>(200, "请求成功", patientExaminationDOS);
    }

    @PostMapping("/list")
    public ResponseResult<PageInfo<PatientExaminationDO>> list(@RequestBody AppointmentTasksPageVO appointmentTasksPageVO) {
        PageInfo<PatientExaminationDO> pageInfo = patientExaminationService.getList(appointmentTasksPageVO);
        return new ResponseResult<>(200, "请求成功", pageInfo);
    }

    @GetMapping("/delete")
    public ResponseResult<Void> delete(@RequestParam Integer id) {
        patientExaminationService.delete(id);
        return new ResponseResult<>(200, "请求成功");
    }
}

